from woniusales_ui_test_3.page.basepage import BasePage
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import random
import time

class StorePage(BasePage):
    batchname_locator = (By.XPATH, '//*[@id="batchname"]/option')  # 批次
    goodsserial_locator = (By.XPATH, '//input[@id="goodsserial"]')  # 货号
    data1 = 'MT777777'
    barcode_locator = (By.XPATH, '//input[@id="barcode"]')  # 条码
    data2 = '987654321'
    inputsize_locator = (By.XPATH, '//input[@id="inputsize"]')  # 尺码
    data3 = 'm-l'
    quantity_locator = (By.XPATH, '//input[@id="quantity"]')  # 数量
    data4 = '20'
    confirm_locator = (By.XPATH, '/html/body/div[4]/div[1]/form[2]/div/input')  # 确认入库
    jiaoyan_locator = (By.XPATH, '//*[@id="storeinfo"]/tr/td[2]')  # 校验

    def click_batchname(self):  # 随机点击批次
        return self.rand_click(self.batchname_locator)

    def input_goodsserial(self):  # 货号
        self.input_text(self.goodsserial_locator,self.data1)

    def input_barcode(self):  # 条码
        self.input_text(self.barcode_locator,self.data2)

    def input_size(self):  # 尺码
        self.input_text(self.inputsize_locator,self.data3)

    def input_quantity(self):  # 数量
        self.input_text(self.quantity_locator,self.data4)

    def click_confirm(self):  # 点击确认入库
        self.click(self.confirm_locator)

    def get_batchname_text(self):
        return self.get_text(self.jiaoyan_locator)




